//import "java.awt.*"; import "javax.swing.*"; import "java.awt.event.*";
//
///*
//	TileDialog.java
//  	(c)1999-2003 SSC Development Team
//	Functions: 
//	-Managing the Tile Editor GUI.
//	Allowed Dependencies: Buffer.java, Tileset.java
//*/
//
//@implementation 
//TileDialog JDialog implements ActionListener, WindowListener
//{
//	JButton next, previous, addt, imp, newts, fill;
//	JLabel current, ntlabel, lelabel;
//	JSpinner nexttile, landeffect;
//	//JTextField imptiles;
//	TileViewPanel tile;
//	Container c = this.getContentPane();
//	Palette chooser;
//	
//	public TileDialog(Frame owner, String title, int curtile)
//	{
//	super(owner,title);
//	this.setSize(470, 300);
//	
//	//interface elements
//	addt = new JButton("add tile");
//	addt.setActionCommand("addtile");
//	imp = new JButton("import "from image")";
//	imp.setActionCommand("imptile");
//	newts = new JButton("new set from image");
//	newts.setActionCommand("newtileset");	
//	next = new JButton("next");
//	next.setActionCommand("next");
//  fill = new JButton("P");
//  fill.setActionCommand("P");
//	current = new JLabel("Current Tile = "+Buffer.getCurTile());
//	previous = new JButton("previous");
//	previous.setActionCommand("previous");
//   	
//	nexttile = new JSpinner();
//	nexttile.setValue(new Integer(Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).getNextTile()));
//  
//  
//  /* Land effect toggle */
//   
//  landeffect = new JSpinner(new SpinnerListModel(Stats.getLEList()));
//  landeffect.setValue(Stats.getLE(Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).landEffect));
//	
//	
//	ntlabel = new JLabel("Next Frame");
//	lelabel = new JLabel("Land Type");
//	chooser = new Palette();
//	tile = new TileViewPanel();
//	//imptiles = new JTextField(35);
//	
//	//interface positioning
//	c.setLayout(null);
//	c.add(current);
//	c.add(previous);
//	c.add(next);
//	c.add(tile);
//	c.add(nexttile);
//	c.add(landeffect);
//	c.add(ntlabel);
//	c.add(lelabel);
//	c.add(chooser);
//	c.add(addt);
//	c.add(fill);
//	c.add(imp);
//	c.add(newts);
//	
//	previous.setBounds(255,5,85,20);
//	next.setBounds(340,5,85,20);
//	tile.setBounds(5,5,240,240);
//	ntlabel.setBounds(255,30,85,20);
//	nexttile.setBounds(340,30,45,20);
//  
//  lelabel.setBounds(255,54,85,20);
//  landeffect.setBounds(340,54,80,20);
//	
//	chooser.setBounds(255,85,200,100);
//	addt.setBounds(255,200,85,20);
//  current.setBounds(345,200,100,20);
//	newts.setBounds(255,225,170,20);
//	
//	fill.setBounds(5,250,50,20);
//	
//	imp.setBounds(255,250,170,20);
//	
//	//Add Listeners
//	previous.addActionListener(this);
//	next.addActionListener(this);
//	addt.addActionListener(this);
//	this.addWindowListener(this);
//	imp.addActionListener(this);
//  fill.addActionListener(this);
//	newts.addActionListener(this);
//	
//	this.setVisible(true);	
//	}
//
//	-(void) actionPerformed(ActionEvent e)
//	{
//	if("imptile".equals(e.getActionCommand()))
//		{
//		FileIO.ImportTileSet(this);	
//		/*String filename = imptiles.getText();
//		System.out.println("The file is: "+filename);
//		if(filename != "") {	
//			Buffer.getCurMap().setTileset(Lib_Util.ImportIntoTileset(filename,Buffer.getCurMap().getTileset()));
//			Buffer.initializeTiles(Buffer.getCurMap());	
//			}*/
//		}
//  if("P".equals(e.getActionCommand())) 
//    {
//    fill.setText("F");
//    fill.setActionCommand("F"); 
//    tile.pf = 1;
//    }
//  if("F".equals(e.getActionCommand())) 
//    {
//    fill.setText("P");
//    fill.setActionCommand("P");  
//    tile.pf = 0;
//    }  
//	if("newtileset".equals(e.getActionCommand())) 
//		{	
//		FileIO.LoadTileset(this);
//		/*String filename = imptiles.getText();
//		System.out.println("The file is: "+filename);
//		if(filename != "") {	
//			Buffer.getCurMap().setTileset(new Tileset(filename));
//			Buffer.initializeTiles(Buffer.getCurMap());	
//			}*/		
//		}
//	if("addtile".equals(e.getActionCommand()))
//		{
//		Buffer.getCurMap().getTileset().addTile();
//		Buffer.addTile();
//		System.out.println(Buffer.getCurMap().getTileset().getLength());	
//		}	
//	if("previous".equals(e.getActionCommand()))
//		{
//		if(Buffer.getCurTile() > 0) 
//			{ 
//			Integer i = (Integer) nexttile.getValue();
//			int j = i.intValue();
//			Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).setNextTile(j);
//			
//      j = Stats.getLE((String)landeffect.getValue());
//      Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).landEffect = j;
//			
//			Buffer.setCurTile(Buffer.getCurTile() - 1);
//			current.setText("Current Tile = "+Buffer.getCurTile());
//			nexttile.setValue(new Integer(Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).getNextTile()));
//      landeffect.setValue(Stats.getLE(Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).landEffect));
//			tile.repaint();
//			}	
//		}	
//	if("next".equals(e.getActionCommand()))
//		{
//		if(Buffer.getCurTile() < (Buffer.getCurMap().getTileset().getLength() - 1)) 
//			{ 
//			Integer i = (Integer) nexttile.getValue();
//			int j = i.intValue();
//			Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).setNextTile(j);
//			
//      j = Stats.getLE((String)landeffect.getValue());
//      Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).landEffect = j;
//			
//			Buffer.setCurTile(Buffer.getCurTile() + 1);
//			current.setText("Current Tile = "+Buffer.getCurTile());
//			nexttile.setValue(new Integer(Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).getNextTile()));
//      landeffect.setValue(Stats.getLE(Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).landEffect));
//			tile.repaint();
//			}		
//		}	
//	}
//	
//	-(void) windowClosing(WindowEvent e) {
//			Integer i = (Integer) nexttile.getValue();
//			int j = i.intValue();
//			Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).setNextTile(j);
//      
//      j = Stats.getLE((String)landeffect.getValue());
//      Buffer.getCurMap().getTileset().getTile(Buffer.getCurTile()).landEffect = j;
//      
//			this.dispose();
//    }
//
//   -(void) windowClosed(WindowEvent e) {   }
//
//   -(void) windowOpened(WindowEvent e) {	}
//
//   -(void) windowIconified(WindowEvent e) {    }
//
//   -(void) windowDeiconified(WindowEvent e) {    }
//
//   -(void) windowActivated(WindowEvent e) {    }
//
//   -(void) windowDeactivated(WindowEvent e) {    }
//}